package lab03.test06;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.*;

public class Test06 {
    public static void main(String[] args) {
        List<String> list=new ArrayList<>();
        Set<String> set=new HashSet<>();
        Map<String,Integer> map=new HashMap<>();

        String line=null;
        //(1)line=null;
        String path="F:\\123.txt";
        RandomAccessFile file=null;//初始化
        String[] arry=new String[100];
        try{
            file=new RandomAccessFile(path,"r");//“r”表示RandomAccessFile流的文件可读
            //“rw”表示读写模式
            while ((line=file.readLine())!=null) {
                //(2)line="schjhxcxhchzczxclZXc ";
                //(3)line="zxczxczxc";
                //(4)line="werteewww";
                //(5)line="df";

                String[] reult = line.split(" ");
                      for (int i=0;i<reult.length;i++){
                             list.add(reult[i]);
                               set.add(reult[i]);
                                            }

            }
            //(6)line="null";
            //(7)line="null"
            //......

            System.out.println("一共出现了单词数为:"+list.size());
            System.out.println("一共出现了互不相同单词:"+set.size());

                /*给出每个单词出现的频率，并将这些单词按频率大小顺序进行打印。*/
                    //暂做
        }



        catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
